package com.learn.spring5.testdemo;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.learn.spring5.config.SpringConfig;
import com.learn.spring5.service.UserService;

public class TestSpring5Demo1
{
	@Test
	public void testCollection1()
	{
		// ApplicationContext context = new
		// ClassPathXmlApplicationContext("bean1.xml");
		// 加载配置类
		ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
		UserService userService = context.getBean("userService", UserService.class);
		System.out.println(userService);
		userService.add();
	}
}
